#include<bits/stdc++.h>
using namespace std;
const int N=1e5;
int n,x,k,a[N+5],c[N+5];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&x);c[x]++;
    }
    for(int i=1;i<=N;i++){
        for(int j=1;j<=c[i];j++){
            a[++k]=i;
        }
    }
    int l=1,r=2;
    while(l<=n&&r<=n){
        if(a[l]<a[r]) l++,r++;
        else r++;
    }printf("%d",n-l+1);
    fclose(stdin);fclose(stdout);
    return 0;
}
